﻿package flow {
	import flash.display.MovieClip;
	import flash.geom.Point;
	
	public class Rotation extends MovieClip {
		private function get rot1():SubRotation { return _rot1; }
		private function get rot2():SubRotation { return _rot2; }

		public function Rotation() {
			
		}
		
		private var _rad:Number = 0;
		public function get GocQuay():Number { return _rad; }
		public function set GocQuay(value:Number){
			if(value < 0){
				_rad = 0;
			} else if(value > 360){
				_rad = 360;
			} else {
				_rad = value;
			}
			if(_rad <= 180){
				this.rot1.rotation = _rad;
				this.rot2.rotation = 180;
			} else if(_rad > 180){
				this.rot1.rotation = 180;
				this.rot2.rotation = _rad;
			}
		}
		
		public function get DiemQuay():Point {
			var point:Point = new Point(0, 0);
			if(this.GocQuay <= 180){
				point = rot1.ViTri;
			} else if(this.GocQuay > 180){
				point = rot2.ViTri;
			}
			return point;
		}
	}
}
